<?php
class YumPicture extends YumActiveRecord
{
    public static function model($className = __CLASS__)
    {
        return parent::model($className);
    }

    public function tableName()
    {
        return "pictures";
    }

    public function rules()
    {
        return array(
            array('file_name,post_id', 'required'),
        );
    }
    public function loadItems($post_id=0)
    {
        $dbItems = self::model()->findAll('post_id=:postId', array(':postId'=>$post_id));
        $items = array();
        foreach ($dbItems as $dbItem) {
            $items[$dbItem->id] = Yum::t($dbItem->name);
        }
        return $items;
    }
}
?>